<?php
/**
 * Created by Lauel
 * Date: 2017/9/26
 * email:11447474@qq.com
 */
$id = $_POST['id'];
$name = $_POST['name'];
$password = $_POST['password'];
include('./mysql.php');

$res = "select * from member where id='$id'";
$result = $mysqli->query($res);
$list = mysqli_fetch_assoc($result);
if ($name == $list['name'] AND $password == $list['password']) {
    die('系统未检测到你修改');
}

$r_sql = "select * from member where name='$name'";
$results = $mysqli->query($r_sql);
$lists = array();
while ($arr = mysqli_fetch_assoc($results)) {
    $lists[] = $arr;
}
if ($lists) {
    die('该姓名已被使用');
}

$sql = "update member set name='$name',password='$password' where id='$id'";
$res = $mysqli->query($sql);
if($res){
    header("Location:list.php");
    die;
}else{
    die('删除失败');
}